package com.dayang.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dayang.dao.BaseDAO;
import com.dayang.model.Userif;
import com.dayang.service.UserService;
@Service("userService")
public class UserServiceImpl implements UserService{
	@Autowired
	private BaseDAO<Userif> baseDAO;

	@Override
	public List<Userif> findAll() {
		return baseDAO.findAll(Userif.class);
	}

	@Override
	public List<Userif> findByUsername(String username) {
		String hql=" from Userif where username=:username";
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("username", username);
	    Query query =	baseDAO.getHqlQuery(hql, map);
		
	    return query.list();
	}

	@Override
	public void mergeItem(Userif user) {
		baseDAO.mergeItem(user);
	}
	


	  

	
	

}
